package com.shenma2009.controller;

import com.shenma2009.domain.ResultResponse;
import com.shenma2009.service.TbProductService;
import com.shenma2009.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 军哥
 * @version 1.0
 * @description: TbProductController
 * @date 2023/4/21 15:23
 */

@RestController
@Slf4j
@RequestMapping(value = "/product")
public class TbProductController {

    @Autowired
    TbProductService tbProductService;

    @PostMapping(value = "/add")
    public ResultResponse add(@RequestBody TbProductVo tbProductVo) {
        return tbProductService.add(tbProductVo);
    }

    @PostMapping(value = "/del")
    public ResultResponse del(@RequestBody TbProductIdVo tbProductIdVo) {
        return tbProductService.del(tbProductIdVo);
    }

    @PostMapping(value = "/set")
    public ResultResponse set(@RequestBody TbProductVo tbProductVo) {
        return tbProductService.set(tbProductVo);
    }

    @PostMapping(value = "/get")
    public ResultResponse get(@RequestBody IdVo idVo) {
        return tbProductService.get(idVo);
    }

    @PostMapping(value = "/list")
    public ResultResponse list(@RequestBody PageVo pageVo) {
        return tbProductService.listByPage(pageVo);
    }

    @PostMapping(value = "/addBuyCar")
    public ResultResponse addBuyCar(@RequestBody BuyCarVo buyCarVo) {
        return tbProductService.addBuyCar(buyCarVo);
    }

    @PostMapping(value = "/getBuyCar")
    public ResultResponse getBuyCar(@RequestBody IdVo idVo) {
        return tbProductService.getBuyCar(idVo);
    }

}
